require_relative '../defaults.rb'

if (repo = ENV['COCOAPODS_SPEC_REPO'])
    source "#{repo}"
end

workspace 'Examples.xcworkspace'

abstract_target 'Abstract Target' do
    use_modular_headers!

    pod 'ObjCPod', path: 'ObjCPod'
    pod 'SwiftPod', path: 'SwiftPod'
    pod 'MixedPod', path: 'MixedPod'
    pod 'CustomModuleMapPod', path: 'CustomModuleMapPod'

    pod 'Alamofire', '5.9.1'

    %w[iOS macOS].each do |platform|
        abstract_target "#{platform} Pods" do
            project "#{platform} Modules.xcodeproj"

            case platform
            when 'iOS' then self.platform :ios, DEFAULT_IOS_DEPLOYMENT_TARGET
            when 'macOS' then self.platform :macos, DEFAULT_MACOS_DEPLOYMENT_TARGET
            end

            target 'Static' do
                use_frameworks!(false)
            end
            target 'Dynamic' do
                use_frameworks!(true)
            end
        end
    end
end

post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
      target.build_configurations.each do |config|
          config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = DEFAULT_MACOS_DEPLOYMENT_TARGET
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = DEFAULT_IOS_DEPLOYMENT_TARGET
      end
    end
  end
end

